package com.william.killian.trivia;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

import com.william.killian.trivia.model.Quiz;
import com.william.killian.trivia.util.Util;

public class QuizCreator extends Activity
{
    @Override
    public void onCreate (Bundle savedInstanceState)
    {
        super.onCreate (savedInstanceState);
        setTheme (android.R.style.Theme_Dialog);
        setContentView (R.layout.quiz_creator);
    }
    
    public void create (View v)
    {
        Quiz q = new Quiz ();
        EditText nameField = (EditText)findViewById (R.id.create_quiz_name);
        String name = nameField.getText ().toString ();
        q.setName (name);
        q.save ();
        Util.quizzes.add (q);
        finish ();
    }
}
